package org.openmore.consumer.dto.common;


import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openmore.common.data.ITreeNode;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


@ApiModel("Permission显示模型")
public class PermissionDto implements ITreeNode {
    @ApiModelProperty(value = "权限id")
    public String id;
    @ApiModelProperty(value = "父级权限id")
    public String parentId;
    @ApiModelProperty(value = "父级权限名")
    public String parentName;
    @ApiModelProperty(value = "权限识别码")
    public String code;
    @ApiModelProperty(value = "权限名")
    public String name;
    @ApiModelProperty(value = "菜单路由")
    public String menu;
    @ApiModelProperty(value = "菜单图标")
    public String menuIcon;

    @ApiModelProperty(value = "排序")
    public Integer sortOrder;
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    public Date createdTime;
    @ApiModelProperty(value = "孩子节点")
    public List<ITreeNode> children;

    @Override
    public void addChild(ITreeNode child) {
        if (children == null) {
            children = new ArrayList<>();
        }
        children.add(child);
    }

    public String getId() {
        return id;
    }

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getCode() {
        return code;
    }

    public Integer getSortOrder() {
        return sortOrder;
    }

    public void setSortOrder(Integer sortOrder) {
        this.sortOrder = sortOrder;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMenu() {
        return menu;
    }

    public void setMenu(String menu) {
        this.menu = menu;
    }

    public String getMenuIcon() {
        return menuIcon;
    }

    public void setMenuIcon(String menuIcon) {
        this.menuIcon = menuIcon;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    @Override
    public List<ITreeNode> getChildren() {
        return children;
    }

    public void setChildren(List<ITreeNode> children) {
        this.children = children;
    }
}